//
//  StatusToolbar.swift
//  ShangHaiWeiBo
//
//  Created by 蔡杰 on 16/3/2.
//  Copyright © 2016年 蔡杰. All rights reserved.
//

import UIKit

class StatusToolbar: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
 
    private let retweetedButton: UIButton = UIButton(
        buttonName: " 转发",
        fontSize: 12,
        backImageName: "timeline_card_bottom_background",
        imageName: "timeline_icon_retweet")
    private let commentButton: UIButton = UIButton(
        buttonName: " 评论",
        fontSize: 12,
        backImageName: "timeline_card_bottom_background",
        imageName: "timeline_icon_comment")
    private let likeButton: UIButton = UIButton(
        buttonName: " 赞",
        fontSize: 12,
        backImageName: "timeline_card_bottom_background",
        imageName: "timeline_icon_unlike")
}

extension StatusToolbar {

    private func setupUI(){
    
//        backgroundColor = UIColor.blueColor()
        
        addSubview(retweetedButton)
        addSubview(commentButton)
        addSubview(likeButton)
        //自动布局
        retweetedButton.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self)
            make.left.equalTo(self)
            make.bottom.equalTo(self)
        }
        commentButton.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(retweetedButton)
            make.left.equalTo(retweetedButton.snp_right)
            make.bottom.equalTo(commentButton)
            make.width.equalTo(retweetedButton)
        }
        likeButton.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(commentButton)
            make.left.equalTo(commentButton.snp_right)
            make.bottom.equalTo(commentButton)
            make.width.equalTo(commentButton)
            make.right.equalTo(self)
        }
        let sepOne = UIImageView(cj_image: "timeline_card_bottom_line")
        let sepTwo = UIImageView(cj_image: "timeline_card_bottom_line")
        addSubview(sepOne)
        addSubview(sepTwo)
        sepOne.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetedButton.snp_right)
            make.centerY.equalTo(retweetedButton)
        }
        sepTwo.snp_makeConstraints { (make) -> Void in
//
            make.left.equalTo(commentButton.snp_right)
//            
             make.centerY.equalTo(commentButton)
        }
    }
    
}